<?php
/**
 * @package		Joomla.Site
 * @subpackage	com_content
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// no direct access
defined('_JEXEC') or die;

// Create a shortcut for params.
$params = &$this->item->params;
$images = json_decode($this->item->images);
$canEdit	= $this->item->params->get('access-edit');

$date_arr= explode(" ",JHtml::_('date', $this->item->publish_up, JText::_('DATE_FORMAT_LC5'))); 




?>

			<div class="article">
					<div class="title">
						<div class="box">
						<?php if ($params->get('show_publish_date')) : ?>
							<p>
							<?php echo $date_arr[0]; ?> <br />
							<?php echo $date_arr[1]; ?> <br />
							<?php echo $date_arr[2]; ?>
							</p>
						<?php endif; ?>
						</div>
						<h1>
							<?php if ($params->get('link_titles') && $params->get('access-view')) : ?>
								<a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>">
								<?php echo $this->escape($this->item->title); ?></a>
							<?php else : ?>
								<?php echo $this->escape($this->item->title); ?>
							<?php endif; ?>
							
							<?php 
									$arr2 = preg_split('/<(IMG|img) /', $this->item->introtext);			    
									$arr3 = preg_split('/src=\"/', $arr2[1]);
									$arr4 = preg_split('/\"/', $arr3[1]);
									if(preg_match('/http:/', $arr4[0]))
									{
										$result = $arr4[0];
									}
									else if(preg_match('/^\//', $arr4[0])){
										$result = $u2 . substr($arr4[0],1);
									}
									else
									{
										for($ei = 3; $ei < sizeof($u1) - 1; $ei++)
										{
										$u2 .= $u1[$ei] . "/";
										}
										$result = $u2 . $arr4[0];				    
									}
							?>
						</h1>
						<p class="intro">
							Đăng bởi: <strong><?php echo ($this->item->created_by_alias ? $this->item->created_by_alias : $this->item->author); ?></strong>; Chuyên mục: <strong><?php echo $this->escape($this->item->category_title) ?></strong>
						</p>
					</div>
					<div class="clear"></div>
					<div class="img">
						<?php if($result !="") {	?>	
										<img src="<?php echo $result; ?>" alt="<?php echo $this->escape($this->item->title); ?>" width="230" height="140" />
						<?php	} ?>
					</div><!--end img-->
					
					<p class="body-text">						
					<?php 
						$arr = explode(" ", strip_tags($this->item->introtext));
						if(count($arr) >= 90)
						{
							$this->item->sintrotext = "";
							for($i=0; $i < 90; $i++)
							{
								$this->item->sintrotext .= $arr[$i]." ";
							}
							$this->item->sintrotext .= "...";
						}
						else $this->item->sintrotext = strip_tags($this->item->introtext);
						$this->item->sintrotext = str_replace("\"", "", $this->item->sintrotext);	
						echo $this->item->sintrotext;

						?>
					<a class="more" href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>">[Đọc thêm...]</a></p>

			</div><!--end article-->
		<div class="clear"></div>

<?php echo $this->item->event->afterDisplayContent; ?>
